import { Button } from 'antd';
import { memo } from 'react';
import { useModel } from 'umi';

function Bar() {
  const { name } = useModel('userModel', (e) => {
    return {
      name: e.user.name,
    };
  });
  console.log('组件更新');

  return (
    <div style={{ background: 'pink', padding: '30px' }}>
      Bar is a awesome component
      {/* <Button style={{ marginLeft: '30px' }}>{name}</Button> */}
      <Button style={{ marginLeft: '30px' }}>{name}</Button>
      {/* <Button style={{ marginLeft: '30px' }}>{sex}</Button> */}
    </div>
  );
}

export default memo(Bar);
